package com.duke.demo.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.duke.demo.entity.Student;
import com.duke.demo.service.IStudentService;

/**
 * 测试jdbc
 * 
 * @author hwang
 *
 */
@Controller
public class StudentController {
	private static final Logger logger = LoggerFactory.getLogger(StudentController.class);

	@Autowired
	private IStudentService studentService;

	@RequestMapping("/studentList")
	public String getStudentList(Model model) {
		logger.info("从数据库");
		Student s = new Student();
		s.setId("2");
		List<Student> students = studentService.getStudentList(s);
		model.addAttribute("content","测试111！");
		model.addAttribute("student", students.get(0));
		return "html/student";
	}
}
